const axios = require('axios');

// 测试后端登录API
async function testLogin() {
  try {
    console.log('正在测试后端登录API...');
    
    const response = await axios.post('http://localhost:8000/auth/token', 
      new URLSearchParams({
        username: 'admin',
        password: 'abc@123456'
      }),
      {
        headers: {
          'Content-Type': 'application/x-www-form-urlencoded'
        }
      }
    );
    
    console.log('登录成功！响应数据：', response.data);
  } catch (error) {
    console.error('登录失败：', error.response?.data || error.message);
  }
}

testLogin();